<template>
    <div class="fen">
        <van-sticky>
    <van-search v-model="value" placeholder="请输入搜索关键词"  @click.native="sarch()" />
        </van-sticky>
        
 <van-tabs v-model="active" animated  @click.native="nativ()">
  <van-tab v-for="(v,index) in list" :title="v.navigationName" :key="index">
   <nativ></nativ>
  </van-tab>
</van-tabs>     
    </div>
</template>
<script>
import nativ from './nativ';

export default {
    components:{nativ},
    name:"Fen",
        data(){
        return{
            active:0,
            list:{},
            value:"",
        }
    },
    methods:{
        nativ(){
            var id = this.active+1;
            sessionStorage.setItem("active",JSON.stringify(id));
            this.$router.push("/nativ/"+id).catch(e=>{})
            console.log("车")
        },
        sarch(){

           this.$router.push("/sarch");
        }
    },
    mounted(){
        this.active=JSON.parse(sessionStorage.getItem("active"))-1
        var token = sessionStorage.getItem("token");
        var str = `token=${token}`
        this.axios.post("http://123.57.130.65:8080/navigation/findAll",str).then(res=>{
            if(res.data.code==200){
                console.log("ok");
                this.list=res.data.data;
            }else{
                this.$router.push("/rester");
            }
        })
    }
}
</script>
<style scoped>
.fen{
    margin:40px 0px;
}
</style>